﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using App.Core.Extensions;
using App.Data;
using System.Data;

public partial class Pages_Admin_SpecialOfferList : BasePage
{
    private int _ID = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        BindPageInfo();
        //if (!IsPostBack)
        //{
        //    CheckAndDeleteData();
        //    BindSpecialOfferList(1);
        //}
    }
    protected void BindPageInfo()
    {
        _ID = WebUtil.GetQueryStringInInt(AppConstants.QueryString.ID);
        Page.Title = WebUtil.GetPageTitle(h4Heading.InnerHtml);
    }
    //protected void CheckAndDeleteData()
    //{
    //    if (String.Compare(WebUtil.GetQueryStringInString(AppConstants.QueryString.DELETE), "True", false) == 0)
    //    {
    //        BtcHousingEntities context = new BtcHousingEntities();
    //        var specialOffer = context.SpecialOffers.FirstOrDefault(P => P.ID == _ID);
    //        if (specialOffer == null)
    //            WebUtil.ShowMessageBox(divMessage, "Sorry! Requested Special Offer was not found for delete.", true);
    //        else
    //        {
    //            context.SpecialOffers.DeleteObject(specialOffer);
    //            context.SaveChanges();
    //            WebUtil.ShowMessageBox(divMessage, "Special Offer Deleted Successfully.", true);
    //        }
    //    }
    //}
    //protected void BindSpecialOfferList(int pageNumber)
    //{
    //    int totalRecord = 0;
    //    UtilityDAO dao = new UtilityDAO();
    //    DataSet ds = dao.GetPagedData(AppSQL.GET_PAGED_SPECIAL_OFFERS, null, pageNumber, ConfigReader.CommonListPageSize, out totalRecord);
    //    ucSpecialOfferList.DataSource = ds.Tables[0];
    //    ucSpecialOfferList.EditLink = AppConstants.Pages.SPECIAL_OFFER_CHANGE + "?" + AppConstants.QueryString.ID + "={0}";
    //    ucSpecialOfferList.DeleteLink = Request.Url.AbsolutePath + "?" + AppConstants.QueryString.ID + "={0}&" + AppConstants.QueryString.DELETE + "=True";
    //    ucSpecialOfferList.DataBind();

    //    ///Bind pager
    //    ucSpecialOfferListPager.TotalRecord = totalRecord;
    //    ucSpecialOfferListPager.PageNo = pageNumber;
    //    ucSpecialOfferListPager.PageSize = ConfigReader.CommonListPageSize;
    //    ucSpecialOfferListPager.TotalRecordMessage = "Total {0} Special Offer(s) found.";
    //    ucSpecialOfferListPager.DataBind();
    //}
    //protected void ucSpecialOfferListPager_PageIndexChanged(object sender, PagerEventArgs e)
    //{
    //    BindSpecialOfferList(e.PageIndex);
    //}
}